package com.database.management.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.database.management.base.BaseDao;
import com.database.management.domain.DbConnection;
import com.database.management.service.IDbConnectionService;

@Controller
public class IndexController {
	
	@Autowired
	private IDbConnectionService iDbConnectionService;
	
	@RequestMapping("/")
	public String index() {
		List<DbConnection> findAll = iDbConnectionService.findAll(Example.of(new DbConnection()), null);
		for (DbConnection db : findAll) {
			BaseDao.addConnection(db);
		}
		return "index";
	}

}
